package com.flute.framework.index.analysis;

import java.io.Reader;

import org.apache.lucene.analysis.WhitespaceTokenizer;
import org.apache.lucene.util.AttributeSource;

import com.flute.tools.util.StringUtil;

public class SpliterTokenizer extends WhitespaceTokenizer {
	public static final char SPLITER = '어';
	public static final String SPLITER_STRING = StringUtil.UNIQUE_STRING;

	/** Construct a new WhitespaceTokenizer. */
	public SpliterTokenizer(Reader in) {
		super(in);
	}

	/** Construct a new WhitespaceTokenizer using a given {@link AttributeSource}. */
	public SpliterTokenizer(AttributeSource source, Reader in) {
		super(source, in);
	}

	/**
	 * Construct a new WhitespaceTokenizer using a given
	 * {@link org.apache.lucene.util.AttributeSource.AttributeFactory}.
	 */
	public SpliterTokenizer(AttributeFactory factory, Reader in) {
		super(factory, in);
	}

	/**
	 * Collects only characters which do not satisfy
	 * {@link Character#isWhitespace(char)}.
	 */
	@Override
	protected boolean isTokenChar(char c) {
		return c != (SPLITER);
	}
}
